#include <iostream>
#include<string.h>
#include<vector>
using namespace std;

const int N = 1010;

int n, V;
int v[N], w[N];
//int dp[N][N];

bool canPartition(vector<int>& nums) {
    int n = nums.size();
    int sum = 0;
    for (auto x : nums) sum += x;
    if (sum % 2 != 0) return false;
    int z = sum / 2;
    vector<vector<bool>> dp(n + 1, vector<bool>(z + 1));
    for (int i = 0; i <= n; i++) dp[i][0] = true;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= z; j++)
        {
            dp[i][j] = dp[i - 1][j];
            if (j >= nums[i - 1]) dp[i][j] = dp[i][j] || dp[i - 1][j - nums[i - 1]];
        }
    }
    return dp[n][z];
}

int main()
{
    /*cin >> n >> V;
    for (int i = 1; i <= n; i++)
        cin >> v[i] >> w[i];

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= V; j++)
        {
            dp[i][j] = dp[i - 1][j];
            if (j >= v[i])
                dp[i][j] = max(dp[i][j], w[i] + dp[i - 1][j - v[i]]);
        }
    }
    cout << dp[n][V] << endl;

    memset(dp, 0, sizeof dp);

    for (int i = 1; i <= V; i++) dp[0][i] = -1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= V; j++)
        {
            dp[i][j] = dp[i - 1][j];
            if (j >= v[i] && dp[i - 1][j - v[i]] != -1)
                dp[i][j] = max(dp[i][j], w[i] + dp[i - 1][j - v[i]]);
        }
    }
    cout << (dp[n][V] == -1 ? 0 : dp[n][V]) << endl;*/

    //cin >> n >> V;
    //for (int i = 1; i <= n; i++)
    //    cin >> v[i] >> w[i];
    //int dp[N] = { 0 };
    //for (int i = 1; i <= n; i++)
    //{
    //    for (int j = V; j >= v[i]; j--)
    //    {
    //        dp[j] = max(dp[j], w[i] + dp[j - v[i]]);
    //    }
    //}
    //cout << dp[V] << endl;

    //memset(dp, 0, sizeof dp);

    //for (int i = 1; i <= V; i++) dp[i] = -1;
    //for (int i = 1; i <= n; i++)
    //{
    //    for (int j = V; j >= v[i]; j--)
    //    {
    //        if (dp[j - v[i]] != -1)
    //            dp[j] = max(dp[j], w[i] + dp[j - v[i]]);
    //    }
    //}
    //cout << (dp[V] == -1 ? 0 : dp[V]) << endl;

    vector<int> v{ 1,3,5 };
    canPartition(v);

    return 0;
}